<template>
  <div
    class="qheader"
    :class="{'has-border': question.Sequence === 0}"
  >
    <template v-if="question.Sequence > 0">
      <div class="number">
        {{ question.Sequence }} / {{ qlength }}
      </div>
      <div class="name-actions">
        <div class="name">
          【{{ question.QuestionTypeName }}】
        </div>
        <div class="actions">
          <!-- eslint-disable vue/eqeqeq -->
          <div
            v-if="$route.query.ShowType == '2' && $route.query.fromResult != '1'"
            class="delete action"
            @click="onRemoveItem"
          >
            <img
              src="~assets/exam/trash.png"
              class="icon"
            >
          </div>
          <!-- <div
            v-if="showCollectBtn"
            class="collect action"
            @click="toggleCollect"
          >
            <img
              :src="isCollected ? collectedIcon : collectIcon"
              class="icon"
            >
          </div>
          <div
            v-if="showCorrective"
            class="collect action"
            @click="feedbackCorrection"
          >
            <img
              src="~assets/exam/feedback.png"
              class="icon"
            >
          </div> -->
        </div>
      </div>
    </template>
    <div
      v-else
      class="name"
    >
      【{{ question.QuestionTypeName }}】
    </div>
  </div>
</template>

<script lang="ts">
import questionRemoveCollect from '@/mixins/questionRemoveCollect'
import mixins from 'vue-typed-mixins'
import { AppInfo } from 'lib/appMethods'
export default mixins(questionRemoveCollect).extend({
  data () {
    return {
      showCollectBtn: AppInfo.isApp,
      showCorrective: this.$store.state.userInfo.UserId !== '-1',
      collectIcon: require('assets/exam/collect.png'),
      collectedIcon: require('assets/exam/collected.png'),
    }
  },
  methods: {
    feedbackCorrection () {
      this.$emit('feedbackCorrection')
    },
  },
})
</script>

<style lang="scss" scoped>
.qheader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: $examHeaderInH5;
  font-size: 32px;
  color: #333;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  padding: 20px 30px;
  z-index: 10;
  background: #fff;
  @include px1border(bottom, #e9e9e9);
  /deep/ {
    .has-header & {
      top: $navBarHeight;
    }
  }
  &.has-border {
    // border-bottom: 1px solid #e9e9e9;
    @include px1border(bottom, #e9e9e9);
  }
}
.number {
  font-size: 28px;
  color: #666;
}
.name {
  font-size: 28px;
  color: #333;
  margin-left: -10px;
}
.name-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
  margin-top: 20px;
}
.actions {
  display: flex;
  align-items: center;
  margin-right: -15px;
}
.icon {
  display: block;
  height: 32px;
}
.action {
  padding: 15px;
}
</style>
